import sys
from arff import arffread
from pprint import pprint

f = open(sys.argv[1])
(name, sparse, alist, m) = arffread(f)

f_out = open('/tmp/acofs.in', 'w')

f_out.seek(0)

num_linhas = str(len(m))
num_colunas = str(len(m[0]))
matriz = str(m)

f_out.write(num_linhas + ' ' + num_colunas + ' ' + str(len(alist[-1][-1])) + '\n')

f_vetor = open('/tmp/vetor_relevancia')
vetor = f_vetor.readline();
f_out.write(vetor)

for line in m:

 	aux = str(line).strip("[]")
	f_out.write(aux.replace(",", '').replace("'", "").replace("positive", "1").replace("negative", "0") + '\n')
